package com.shire.shire_interface.service.group.impl;

import com.shire.shire_interface.dao.group.WxGroupWaitDao;
import com.shire.shire_interface.model.group.WxGroupWait;
import com.shire.shire_interface.model.group.WxGroupWaitExample;
import com.shire.shire_interface.service.group.WxGroupWaitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class WxGroupWaitServiceImpl implements WxGroupWaitService {

    @Autowired
    private WxGroupWaitDao groupWaitDao;

    @Override
    public int insertGroupWait(WxGroupWait groupWait) {
        return groupWaitDao.insertSelective(groupWait);
    }

    @Override
    public WxGroupWait getGroupWait(Integer csId, String wxAccount, String groupId) {
        WxGroupWaitExample groupWaitExample = new WxGroupWaitExample();
        groupWaitExample.createCriteria().andWxaccountEqualTo(wxAccount).andGroupnoEqualTo(groupId);

        List<WxGroupWait> list = groupWaitDao.selectByExample(groupWaitExample);
        if (list.size()>0)
            return list.get(0);

        return null;
    }
}
